import * as types from "../types";

const defaultState = {
  counter: 100,
  todos: [],
};

export const reducers = (state = defaultState, action) => {
  switch (action.type) {
    case types.APP_INCREMENT:
      return { ...state, counter: (state.counter += action.value) };

    case types.APP_DECREMENT:
      return { ...state, counter: (state.counter -= action.value) };
    case types.APP_GET_TODOS:
      return { ...state, todos: action.value };
    default:
      return state;
  }
};
